home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / hplip / ui4 / firmwaredialog.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-10-28  |  3KB  |  77 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import operator
  5. from base.g import *
  6. from base import device, utils
  7. from prnt import cups
  8. from base.codes import *
  9. from ui_utils import *
  10. from PyQt4.QtCore import *
  11. from PyQt4.QtGui import *
  12. from firmwaredialog_base import Ui_Dialog
  13.  
  14. class FirmwareDialog(QDialog, Ui_Dialog):
  15.     
  16.     def __init__(self, parent, device_uri):
  17.         QDialog.__init__(self, parent)
  18.         self.setupUi(self)
  19.         self.device_uri = device_uri
  20.         self.initUi()
  21.         QTimer.singleShot(0, self.updateUi)
  22.  
  23.     
  24.     def initUi(self):
  25.         self.DeviceComboBox.setFilter({
  26.             'fw-download': (operator.gt, 0) })
  27.         self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_noDevices'), self.DeviceUriComboBox_noDevices)
  28.         self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_currentChanged'), self.DeviceUriComboBox_currentChanged)
  29.         self.connect(self.CancelButton, SIGNAL('clicked()'), self.close)
  30.         self.connect(self.DownloadFirmwareButton, SIGNAL('clicked()'), self.downloadFirmware)
  31.         self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
  32.         if self.device_uri:
  33.             self.DeviceComboBox.setInitialDevice(self.device_uri)
  34.         
  35.  
  36.     
  37.     def updateUi(self):
  38.         self.DeviceComboBox.updateUi()
  39.  
  40.     
  41.     def DeviceUriComboBox_currentChanged(self, device_uri):
  42.         self.device_uri = device_uri
  43.  
  44.     
  45.     def DeviceUriComboBox_noDevices(self):
  46.         FailureUI(self, self._FirmwareDialog__tr('<b>No devices that support firmware download found.</b>'))
  47.         self.close()
  48.  
  49.     
  50.     def downloadFirmware(self):
  51.         d = None
  52.         
  53.         try:
  54.             d = device.Device(self.device_uri)
  55.         except Error:
  56.             CheckDeviceUI(self)
  57.             return None
  58.         else:
  59.             
  60.             try:
  61.                 d.open()
  62.             except Error:
  63.                 CheckDeviceUI(self)
  64.  
  65.             if d.isIdleAndNoError():
  66.                 ok = d.downloadFirmware()
  67.             else:
  68.                 CheckDeviceUI(self)
  69.  
  70.         self.close()
  71.  
  72.     
  73.     def __tr(self, s, c = None):
  74.         return qApp.translate('FirmwareDialog', s, c)
  75.  
  76.  
  77.